#include <bits/stdc++.h>
#include "graph.h"
// #include "grader.cpp"
using namespace std;

const int M=205;
vector<int> T[M];
int U[M*M],V[M*M],ucnt;
int pcnt=2;
void dfs(){
	int deg=NumberOfRoads();
	int col=pcnt;
	for(int i=1;i<=deg;i++){
		int nxtc=++pcnt;
		Move(i,col);
		int bak=LastRoad();
		if(Color()!=1)nxtc=Color(),pcnt--;
		else T[col].push_back(pcnt),dfs();
		Move(bak,nxtc);
		U[++ucnt]=col;
		V[ucnt]=nxtc;
	}
	return;
}
int dis[M][M],ans[M];
inline void floyd(int R){
	for(int i=1;i<=pcnt;i++)for(int j=1;j<=pcnt;j++)dis[i][j]=1e9;
	for(int i=1;i<=pcnt;i++)dis[i][i]=0;
	for(int i=1;i<=ucnt;i++)dis[U[i]][V[i]]=dis[V[i]][U[i]]=1,assert(U[i]^V[i]);
	for(int i=1;i<=pcnt;i++)for(int j=1;j<=pcnt;j++)for(int k=1;k<=pcnt;k++)
		dis[j][k]=min(dis[j][k],dis[j][i]+dis[i][k]);
	for(int i=1;i<=pcnt;i++)for(int j=i+1;j<=pcnt;j++)if(dis[i][j]<=R)ans[dis[i][j]]++;
	return;
}
void Inspect(int R) {
    // Write your code here.
    if(!NumberOfRoads())goto END;
    Move(1,2),Move(LastRoad(),1);
    dfs();
    floyd(R);
    END:;
    for(int i=1;i<=R;i++)Answer(i,ans[i]);
    return;
}
